#!/bin/bash
# ASR-LLM-TTS 环境自动配置脚本

echo "=== 开始环境配置 ==="

# 安装系统依赖
echo "安装系统依赖..."
sudo apt update && sudo apt install -y python3-spacemit-ort spacemit-ollama-toolkit virtualenv wget

# 创建虚拟环境
echo "创建Python虚拟环境..."
virtualenv ~/demo-env
source ~/demo-env/bin/activate

# 配置Python依赖
echo "安装Python依赖..."
pip config set global.extra-index-url https://git.spacemit.com/api/v4/projects/33/packages/pypi/simple
pip install -r requirements.txt

# 配置Ollama模型
echo "设置Ollama模型..."
mkdir -p ~/my-ollama
cd ~/my-ollama
wget https://archive.spacemit.com/spacemit-ai/openwebui/deepseek-r1-1.5b.modelfile
wget https://www.modelscope.cn/models/ggml-org/DeepSeek-R1-Distill-Qwen-1.5B-Q4_0-GGUF/resolve/master/deepseek-r1-distill-qwen-1.5b-q4_0.gguf
ollama create deepseek-r1-1.5b -f deepseek-r1-1.5b.modelfile

# 复制NLTK数据
echo "配置NLTK数据..."
cd ~/asr-llm-tts/
cp -r nltk_data ~/

echo "=== 环境配置完成 ==="
echo "请执行以下命令启动项目："
echo "source ~/demo-env/bin/activate"
echo "cd src && python main.py"